package cn.wei.srb.sms.utils;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Getter
@Setter
@Component
//注意prefix要写到最后一个 "." 符号之前
//调用setter为成员赋值
@ConfigurationProperties(prefix = "tengxun.sms")//从配置文件读取
public class SmsProperties implements InitializingBean {
    private String secretId;
    private String secretKey;
    private String appid;
    private String sign;
    private String templateID;
    public static String SECRET_ID;
    public static String SECRET_KEY;
    public static String APP_ID;
    public static String SIGN;
    public static String TEMPLATE_ID;

    @Override
    public void afterPropertiesSet() throws Exception {
        SECRET_ID=secretId;
        SECRET_KEY=secretKey;
        APP_ID=appid;
        SIGN=sign;
        TEMPLATE_ID=templateID;
    }
}
